<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<infopost-request>
			<request-head>
				<trans-id>
					<xsl:value-of select="/BusinessTransactionRequest/BusinessTransaction/transationId"/>
				</trans-id>
				<xsl:call-template name="TransTypeCode">
					<xsl:with-param name="srcCode" select="/BusinessTransactionRequest/BusinessTransaction/kind"/>
				</xsl:call-template>
				<insu-id/>
				<trans-date>
					<xsl:value-of select="concat(substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),1,4),substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),6,2),substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),9,2))"/>
				</trans-date>
				<trans-time>
					<xsl:value-of select="concat(substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),12,2),substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),15,2),substring(string(/BusinessTransactionRequest/BusinessTransaction/transationDate),18,2))"/>
				</trans-time>
				<area>
					<xsl:value-of select="/BusinessTransactionRequest/Order/orderNumber"/>
				</area>
				<bank/>
				<branch/>
				<post>
					<xsl:value-of select="/BusinessTransactionRequest/BusinessTransaction/partnerCode"/>
				</post>
				<agency-hand/>
				<authorized>life</authorized>
			</request-head>
			<request-newbiz>
				<request-underwriting>
					<application>
						<apply-code>
							<xsl:value-of select="/BusinessTransactionRequest/InsurancePolicy/applicationNumber"/>
						</apply-code>
						<policy-type>1</policy-type>
						<group-single>2</group-single>
						<branch-bank/>
						<agent-tel/>
						<pkg-unit/>
						<xsl:for-each select="/BusinessTransactionRequest/InsurancePolicy/Roles/Role">
							<xsl:choose>
								<xsl:when test="kind='PremiumAccount' ">
									<xsl:for-each select="Properties/Property">
										<xsl:choose>
											<xsl:when test="@kind='bankName' ">
												<bank-code>
													<xsl:value-of select="@value"/>
												</bank-code>
											</xsl:when>
											<xsl:when test="@kind='acctHolderName' ">
												<account-name>
													<xsl:value-of select="@value"/>
												</account-name>
												<acc-bankname>
													<xsl:value-of select="@value"/>
												</acc-bankname>
											</xsl:when>
											<xsl:when test="@kind='accountNumber' ">
												<bank-account>
													<xsl:value-of select="@value"/>
												</bank-account>
												<bank-accno>
													<xsl:value-of select="@value"/>
												</bank-accno>
											</xsl:when>
										</xsl:choose>
									</xsl:for-each>
								</xsl:when>
								<xsl:when test="kind='SellingChannel' ">
									<xsl:for-each select="Properties/Property">
										<xsl:choose>
											<xsl:when test="@kind='channelCode' ">
												<xsl:call-template name="srcChannelCode">
													<xsl:with-param name="srcCode" select="@value"/>
												</xsl:call-template>
											</xsl:when>
										</xsl:choose>
									</xsl:for-each>
								</xsl:when>
							</xsl:choose>
						</xsl:for-each>
						<account-type>2</account-type>
						<pay-mode>
							<xsl:value-of select="/BusinessTransactionRequest/InsurancePolicy/payMode"/>
						</pay-mode>
						<!--<pay-next>
              <xsl:value-of select="/BusinessTransactionRequest/InsurancePolicy/payMode"/>
            </pay-next>-->
						<pay-next>
							<xsl:value-of select="/BusinessTransactionRequest/InsurancePolicy/payNext"/>
						</pay-next>
						<overdue-manage>1</overdue-manage>
						<over-manage>2</over-manage>
						<deliver-type>4</deliver-type>
						<currency-code>1</currency-code>
						<assumpsit/>
						<answer-type>1</answer-type>
						<answer-phone/>
						<answer-assumpsit/>
						<health-notice>Y</health-notice>
						<policy-pwd/>
						<print-code>
							<xsl:value-of select="/BusinessTransactionRequest/InsurancePolicy/externalReference"/>
						</print-code>
						<column1>
							<xsl:value-of select="/BusinessTransactionRequest/Order/orderNumber"/>
						</column1>
						<column2>
							<xsl:value-of select="/BusinessTransactionRequest/Order/orderAmount"/>
						</column2>
						<column4>
							<xsl:value-of select="/BusinessTransactionRequest/Order/paymentStatus"/>
						</column4>
						<!--add by justin.gao only depend on main product -->
						<!--EShengLeYou Product Type-->
						<xsl:for-each select="/BusinessTransactionRequest/InsurancePolicy/products/product/Properties">
							<xsl:if test="Property[@kind='initialType' and @value=1]">
								<xsl:for-each select="Property">
									<xsl:choose>
										<xsl:when test="@kind='grossPremium' ">
											<premium>
												<xsl:value-of select="@value"/>
											</premium>
										</xsl:when>
										<xsl:when test="@kind='beneficiaryMode' ">
											<column3>
												<xsl:value-of select="@value"/>
											</column3>
										</xsl:when>
										<xsl:when test="@kind='plannedEndDate' ">
											<column5>
												<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
											</column5>
										</xsl:when>
										<xsl:when test="@kind='issueDate' ">
											<apply-date>
												<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
											</apply-date>
										</xsl:when>
										<xsl:when test="@kind='inceptionDate' ">
											<validate-date>
												<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
											</validate-date>
										</xsl:when>
										<xsl:when test="@kind='appSignedDate' ">
											<agency-code>
												<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
											</agency-code>
										</xsl:when>
										<xsl:when test="@kind='underwritingDate' ">
											<agency-hand>
												<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
											</agency-hand>
										</xsl:when>
										<xsl:when test="@kind='payTime' ">
											<agent-code>
												<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
											</agent-code>
										</xsl:when>
										<xsl:when test="@kind='deliveryReceiptDate' ">
											<agent-name>
												<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
											</agent-name>
										</xsl:when>
									</xsl:choose>
								</xsl:for-each>
							</xsl:if>
						</xsl:for-each>
						<!--WenYingYiSheng Type-->
						<xsl:for-each select="/BusinessTransactionRequest/InsurancePolicy/Properties/Property">
							<xsl:choose>
								<xsl:when test="@kind='grossPremium' ">
									<premium>
										<xsl:value-of select="@value"/>
									</premium>
								</xsl:when>
								<xsl:when test="@kind='beneficiaryMode' ">
									<column3>
										<xsl:value-of select="@value"/>
									</column3>
								</xsl:when>
								<xsl:when test="@kind='plannedEndDate' ">
									<column5>
										<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
									</column5>
								</xsl:when>
								<xsl:when test="@kind='issueDate' ">
									<apply-date>
										<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
									</apply-date>
								</xsl:when>
								<xsl:when test="@kind='inceptionDate' ">
									<validate-date>
										<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
									</validate-date>
								</xsl:when>
								<xsl:when test="@kind='appSignedDate' ">
									<agency-code>
										<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
									</agency-code>
								</xsl:when>
								<xsl:when test="@kind='underwritingDate' ">
									<agency-hand>
										<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
									</agency-hand>
								</xsl:when>
								<xsl:when test="@kind='payTime' ">
									<agent-code>
										<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
									</agent-code>
								</xsl:when>
								<xsl:when test="@kind='deliveryReceiptDate' ">
									<agent-name>
										<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
									</agent-name>
								</xsl:when>
							</xsl:choose>
						</xsl:for-each>
						<policy-holder>
							<xsl:for-each select="/BusinessTransactionRequest/InsurancePolicy/Roles/Role">
								<xsl:choose>
									<xsl:when test="kind='Applicant' ">
										<xsl:for-each select="Properties/Property">
											<xsl:choose>
												<xsl:when test="@kind='fullName' ">
													<real-name>
														<xsl:value-of select="@value"/>
													</real-name>
												</xsl:when>
												<xsl:when test="@kind='gender' ">
													<xsl:choose>
														<xsl:when test="@value = 'MALE' ">
															<gender>M</gender>
														</xsl:when>
														<xsl:when test="@value = 'FEMALE' ">
															<gender>F</gender>
														</xsl:when>
														<xsl:otherwise>
															<gender>N</gender>
														</xsl:otherwise>
													</xsl:choose>
												</xsl:when>
												<xsl:when test="@kind='birthDate' ">
													<birthday>
														<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
													</birthday>
												</xsl:when>
												<xsl:when test="@kind='idType' ">
													<xsl:choose>
														<xsl:when test="@value = 'SOCIAL_SECURITY_CARD' ">
															<certi-type>1</certi-type>
															<nationality>37</nationality>
														</xsl:when>
														<xsl:when test="@value = 'PASSPORT' ">
															<certi-type>3</certi-type>
															<nationality>37</nationality>
														</xsl:when>
														<xsl:when test="@value = 'RETURN_CARD' ">
															<certi-type>6</certi-type>
															<nationality>37</nationality>
														</xsl:when>
														<xsl:when test="@value = 'HOUSE_CARD' ">
															<certi-type>7</certi-type>
															<nationality>37</nationality>
														</xsl:when>
														<xsl:when test="@value = 'SERGEANT_CARd' ">
															<certi-type>8</certi-type>
															<nationality>37</nationality>
														</xsl:when>
														<xsl:otherwise>
															<certi-type>9</certi-type>
															<nationality/>
														</xsl:otherwise>
													</xsl:choose>
												</xsl:when>
												<xsl:when test="@kind='idNumber' ">
													<certi-code>
														<xsl:value-of select="@value"/>
													</certi-code>
												</xsl:when>
												<xsl:when test="@kind='province' ">
													<city-province>
														<xsl:value-of select="@value"/>
													</city-province>
												</xsl:when>
												<xsl:when test="@kind='city' ">
													<district>
														<xsl:value-of select="@value"/>
													</district>
												</xsl:when>
												<xsl:when test="@kind='email' ">
													<email>
														<xsl:value-of select="@value"/>
													</email>
												</xsl:when>
												<xsl:when test="@kind='phoneNumber' ">
													<celler>
														<xsl:value-of select="@value"/>
													</celler>
												</xsl:when>
												<xsl:when test="@kind='postalCode' ">
													<rela-zip>
														<xsl:value-of select="@value"/>
													</rela-zip>
												</xsl:when>
												<xsl:when test="@kind='postalAddress' ">
													<rela-address>
														<xsl:value-of select="@value"/>
													</rela-address>
												</xsl:when>
												<!--<xsl:when test="@kind='jobCode' ">
                          <job-code>
                            <xsl:value-of select="@value"/>
                          </job-code>
                        </xsl:when>
                        
                        <xsl:when test="@kind='income' ">
                          <yearly-income>
                            <xsl:value-of select="@value"/>
                          </yearly-income>
                        </xsl:when>
                        -->
												<xsl:when test="@kind='occupationType' ">
													<job-code>
														<xsl:value-of select="@value"/>
													</job-code>
												</xsl:when>
												<xsl:when test="@kind='annualSalary' ">
													<yearly-income>
														<xsl:value-of select="@value"/>
													</yearly-income>
												</xsl:when>
												<xsl:when test="@kind='certiExpireDate' ">
													<certi-end-date>
														<xsl:value-of select="@value"/>
													</certi-end-date>
												</xsl:when>
											</xsl:choose>
										</xsl:for-each>
									</xsl:when>
								</xsl:choose>
							</xsl:for-each>
							<marriage-id/>
							<race/>
							<homeplace/>
							<seat-address/>
							<certi-start-date/>
							<!--<certi-end-date/>-->
							<ward/>
							<day-phone/>
							<night-phone/>
							<pay-address/>
							<pay-zip/>
							<job-com/>
							<job-address/>
							<job-zip/>
							<industy/>
							<title/>
							<job-name/>
							<pt-job-name/>
							<relation-with-main-insured/>
							<smoking>N</smoking>
							<income-source/>
							<social-security/>
							<height/>
							<weight/>
							<valid-year/>
							<social-security-status/>
						</policy-holder>
						<life-assureds>
							<life-assured>
								<la-no>
									<xsl:number value="position()"/>
								</la-no>
								<xsl:for-each select="/BusinessTransactionRequest/InsurancePolicy/Roles/Role">
									<xsl:choose>
										<xsl:when test="kind='Insured' ">
											<xsl:for-each select="Properties/Property">
												<xsl:choose>
													<xsl:when test="@kind='applicantRelatedToInsured' ">
														<xsl:choose>
															<xsl:when test="@value = 'SELF' ">
																<relation-with-policy-holder>1</relation-with-policy-holder>
																<relation-with-main-insured>1</relation-with-main-insured>
															</xsl:when>
															<xsl:when test="@value = 'CHILD' ">
																<relation-with-policy-holder>2</relation-with-policy-holder>
																<relation-with-main-insured>2</relation-with-main-insured>
															</xsl:when>
															<xsl:when test="@value = 'SPOUSE' ">
																<relation-with-policy-holder>3</relation-with-policy-holder>
																<relation-with-main-insured>3</relation-with-main-insured>
															</xsl:when>
															<xsl:when test="@value = 'Employee' ">
																<relation-with-policy-holder>4</relation-with-policy-holder>
																<relation-with-main-insured>4</relation-with-main-insured>
															</xsl:when>
															<xsl:when test="@value = 'Employer' ">
																<relation-with-policy-holder>5</relation-with-policy-holder>
																<relation-with-main-insured>5</relation-with-main-insured>
															</xsl:when>
															<xsl:when test="@value = 'Ward' ">
																<relation-with-policy-holder>6</relation-with-policy-holder>
																<relation-with-main-insured>6</relation-with-main-insured>
															</xsl:when>
															<xsl:otherwise>
																<relation-with-policy-holder>7</relation-with-policy-holder>
																<relation-with-main-insured>7</relation-with-main-insured>
															</xsl:otherwise>
														</xsl:choose>
													</xsl:when>
													<xsl:when test="@kind='fullName' ">
														<real-name>
															<xsl:value-of select="@value"/>
														</real-name>
													</xsl:when>
													<xsl:when test="@kind='gender' ">
														<xsl:choose>
															<xsl:when test="@value = 'MALE' ">
																<gender>M</gender>
															</xsl:when>
															<xsl:when test="@value = 'FEMALE' ">
																<gender>F</gender>
															</xsl:when>
															<xsl:otherwise>
																<gender>N</gender>
															</xsl:otherwise>
														</xsl:choose>
													</xsl:when>
													<xsl:when test="@kind='birthDate' ">
														<birthday>
															<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
														</birthday>
													</xsl:when>
													<xsl:when test="@kind='idType' ">
														<xsl:choose>
															<xsl:when test="@value = 'SOCIAL_SECURITY_CARD' ">
																<certi-type>1</certi-type>
																<nationality>37</nationality>
															</xsl:when>
															<xsl:when test="@value = 'PASSPORT' ">
																<certi-type>3</certi-type>
																<nationality>37</nationality>
															</xsl:when>
															<xsl:when test="@value = 'RETURN_CARD' ">
																<certi-type>6</certi-type>
																<nationality>37</nationality>
															</xsl:when>
															<xsl:when test="@value = 'HOUSE_CARD' ">
																<certi-type>7</certi-type>
																<nationality>37</nationality>
															</xsl:when>
															<xsl:when test="@value = 'SERGEANT_CARd' ">
																<certi-type>8</certi-type>
																<nationality>37</nationality>
															</xsl:when>
															<xsl:otherwise>
																<certi-type>9</certi-type>
																<nationality/>
															</xsl:otherwise>
														</xsl:choose>
													</xsl:when>
													<xsl:when test="@kind='idNumber' ">
														<certi-code>
															<xsl:value-of select="@value"/>
														</certi-code>
													</xsl:when>
													<xsl:when test="@kind='phoneNumber' ">
														<celler>
															<xsl:value-of select="@value"/>
														</celler>
													</xsl:when>
													<xsl:when test="@kind='occupationType' ">
														<job-code>
															<xsl:value-of select="@value"/>
														</job-code>
													</xsl:when>
													<xsl:when test="@kind='annualSalary' ">
														<yearly-income>
															<xsl:value-of select="@value"/>
														</yearly-income>
													</xsl:when>
													<xsl:when test="@kind='certiExpireDate' ">
														<certi-end-date>
															<xsl:value-of select="@value"/>
														</certi-end-date>
													</xsl:when>
												</xsl:choose>
											</xsl:for-each>
										</xsl:when>
									</xsl:choose>
								</xsl:for-each>
								<marriage-id/>
								<race/>
								<homeplace/>
								<seat-address/>
								<certi-start-date/>
								<!--<certi-end-date/>-->
								<city-province/>
								<district/>
								<ward/>
								<rela-address/>
								<rela-zip/>
								<night-phone/>
								<day-phone/>
								<email/>
								<job-com/>
								<job-address/>
								<job-zip/>
								<industy/>
								<title/>
								<job-name/>
								<pt-job-name/>
								<!--<job-code/>-->
								<smoking>N</smoking>
								<!--<yearly-income/>-->
								<income-source/>
								<height/>
								<weight/>
								<valid-year/>
								<social-security/>
								<social-security-status/>
							</life-assured>
						</life-assureds>
						<beneficiaries>
							<beneficiary>
								<la-no>
									<xsl:number value="position()"/>
								</la-no>
								<legal-bene-indi>Y</legal-bene-indi>
								<bene-is-empty>Y</bene-is-empty>
								<xsl:for-each select="/BusinessTransactionRequest/InsurancePolicy/Roles/Role">
									<xsl:choose>
										<xsl:when test="kind='Beneficiary' ">
											<xsl:for-each select="Properties/Property">
												<xsl:choose>
													<xsl:when test="@kind='fullName' ">
														<real-name>
															<xsl:value-of select="@value"/>
														</real-name>
													</xsl:when>
													<xsl:when test="@kind='gender' ">
														<xsl:choose>
															<xsl:when test="@value = 'MALE' ">
																<gender>M</gender>
															</xsl:when>
															<xsl:when test="@value = 'FEMALE' ">
																<gender>F</gender>
															</xsl:when>
															<xsl:otherwise>
																<gender>N</gender>
															</xsl:otherwise>
														</xsl:choose>
													</xsl:when>
													<xsl:when test="@kind='birthDate' ">
														<birthday>
															<xsl:value-of select="concat(substring(string(@value),1,4),substring(string(@value),6,2),substring(string(@value),9,2))"/>
														</birthday>
													</xsl:when>
													<xsl:when test="@kind='idType' ">
														<xsl:choose>
															<xsl:when test="@value = 'SOCIAL_SECURITY_CARD' ">
																<certi-type>1</certi-type>
																<nationality>37</nationality>
															</xsl:when>
															<xsl:when test="@value = 'PASSPORT' ">
																<certi-type>3</certi-type>
																<nationality>37</nationality>
															</xsl:when>
															<xsl:when test="@value = 'RETURN_CARD' ">
																<certi-type>6</certi-type>
																<nationality>37</nationality>
															</xsl:when>
															<xsl:when test="@value = 'HOUSE_CARD' ">
																<certi-type>7</certi-type>
																<nationality>37</nationality>
															</xsl:when>
															<xsl:when test="@value = 'SERGEANT_CARd' ">
																<certi-type>8</certi-type>
																<nationality>37</nationality>
															</xsl:when>
															<xsl:otherwise>
																<certi-type>9</certi-type>
																<nationality/>
															</xsl:otherwise>
														</xsl:choose>
													</xsl:when>
													<xsl:when test="@kind='idNumber' ">
														<certi-code>
															<xsl:value-of select="@value"/>
														</certi-code>
													</xsl:when>
													<xsl:when test="@kind='BenefitRelatedToInsured' ">
														<xsl:choose>
															<xsl:when test="@value = 'Wife' ">
																<relation-with-insured>1</relation-with-insured>
															</xsl:when>
															<xsl:when test="@value = 'Husband' ">
																<relation-with-insured>2</relation-with-insured>
															</xsl:when>
															<xsl:when test="@value = 'Child' ">
																<relation-with-insured>3</relation-with-insured>
															</xsl:when>
															<xsl:when test="@value = 'Mother' ">
																<relation-with-insured>5</relation-with-insured>
															</xsl:when>
															<xsl:when test="@value = 'Father' ">
																<relation-with-insured>4</relation-with-insured>
															</xsl:when>
															<xsl:when test="@value = 'Grandfather' ">
																<relation-with-insured>6</relation-with-insured>
															</xsl:when>
															<xsl:when test="@value = 'Grandmother' ">
																<relation-with-insured>7</relation-with-insured>
															</xsl:when>
															<xsl:when test="@value = 'Brother(Sister)' ">
																<relation-with-insured>8</relation-with-insured>
															</xsl:when>
															<xsl:otherwise>
																<relation-with-insured>15</relation-with-insured>
															</xsl:otherwise>
														</xsl:choose>
													</xsl:when>
												</xsl:choose>
											</xsl:for-each>
										</xsl:when>
									</xsl:choose>
								</xsl:for-each>
								<certi-start-date/>
								<certi-end-date/>
								<bene-type>2</bene-type>
								<bene-order>1</bene-order>
								<bene-rate>100</bene-rate>
							</beneficiary>
						</beneficiaries>
						<!--add by justin.gao-->
						<products>
							<xsl:call-template name="subProduct1"/>
							<xsl:call-template name="subProduct2"/>
						</products>
					</application>
				</request-underwriting>
				<request-policy-issue>
					<apply-code>
						<xsl:value-of select="/BusinessTransactionRequest/InsurancePolicy/applicationNumber"/>
					</apply-code>
					<uw-trans-id/>
					<invoice-code/>
					<print-code>
						<xsl:value-of select="/BusinessTransactionRequest/InsurancePolicy/externalReference"/>
					</print-code>
					<!--add by justin.gao-->
					<xsl:call-template name="sum">
						<xsl:with-param name="nodes" select="/BusinessTransactionRequest/InsurancePolicy/products/product/Properties/Property[@kind='grossPremium']"/>
					</xsl:call-template>
					<xsl:for-each select="/BusinessTransactionRequest/InsurancePolicy/Properties/Property">
						<xsl:choose>
							<xsl:when test="@kind='grossPremium' ">
								<premium>
									<xsl:value-of select="@value"/>
								</premium>
							</xsl:when>
						</xsl:choose>
					</xsl:for-each>
					<allow-manual-uw/>
					<policy-print-type>
						<xsl:value-of select="/BusinessTransactionRequest/InsurancePolicy/bankCode"/>
					</policy-print-type>
				</request-policy-issue>
			</request-newbiz>
		</infopost-request>
	</xsl:template>
	<xsl:template name="srcChannelCode">
		<xsl:param name="srcCode"/>
		<xsl:choose>
			<xsl:when test="$srcCode = 'WEIXIN' ">
				<sell-way>14</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'JINGDONG' ">
				<sell-way>15</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'GUANWANG' ">
				<sell-way>13</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'GWAPP' ">
				<sell-way>16</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'taobao' ">
				<sell-way>8</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'alipay' ">
				<sell-way>12</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'LUFAX' ">
				<sell-way>21</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'QIANXS' ">
				<sell-way>22</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'ININS' ">
				<sell-way>23</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'ZHONGMIN' ">
				<sell-way>24</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'YYLC' ">
				<sell-way>25</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'QUNA' ">
				<sell-way>26</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'TIANYA' ">
				<sell-way>27</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'IPANSUAN' ">
				<sell-way>28</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'SW' ">
				<sell-way>29</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'GZJH' ">
				<sell-way>30</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'JINFUZI' ">
				<sell-way>31</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'SINA' ">
				<sell-way>32</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'RONG' ">
				<sell-way>33</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'YUANSHI' ">
				<sell-way>34</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'GWYDD' ">
				<sell-way>35</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'F-FAX' ">
				<sell-way>36</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'ANYING' ">
				<sell-way>37</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'QIANYUN' ">
				<sell-way>38</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'PAZT' ">
				<sell-way>39</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'WANGYI' ">
				<sell-way>40</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'BAOSHANG' ">
				<sell-way>41</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'LAKALA' ">
				<sell-way>42</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'WEIZHONG' ">
				<sell-way>43</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'SHJH' ">
				<sell-way>44</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'MSDS' ">
				<sell-way>45</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'HUAXING' ">
				<sell-way>46</sell-way>
			</xsl:when>
			<xsl:when test="$srcCode = 'SUNING' ">
				<sell-way>47</sell-way>
			</xsl:when>
			<xsl:otherwise>
				<sell-way>13</sell-way>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="TransTypeCode">
		<xsl:param name="srcCode"/>
		<xsl:choose>
			<xsl:when test="$srcCode = 'New Underwriting' ">
				<trans-type>102</trans-type>
			</xsl:when>
			<xsl:when test="$srcCode = 1006">
				<trans-type>106</trans-type>
			</xsl:when>
			<xsl:when test="$srcCode = 1004">
				<trans-type>201</trans-type>
			</xsl:when>
			<xsl:when test="$srcCode = 1003">
				<trans-type>108</trans-type>
			</xsl:when>
			<xsl:when test="$srcCode = 1005">
				<trans-type>204</trans-type>
			</xsl:when>
			<xsl:otherwise>
				<trans-type>000000</trans-type>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="switchInusredValue">
		<xsl:param name="srcRelaToPh"/>
		<xsl:param name="srcInusredValue"/>
		<xsl:param name="srcPHValue"/>
		<xsl:choose>
			<xsl:when test="$srcRelaToPh = '1'">
				<xsl:value-of select="string($srcPHValue)"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="string($srcInusredValue)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="NationMapByCertyType">
		<xsl:param name="srcCode"/>
		<xsl:choose>
			<xsl:when test="$srcCode = 110001 or $srcCode = 110002 or $srcCode = 110003 or $srcCode = 110004 ">
				<nationality>37</nationality>
			</xsl:when>
			<xsl:when test="$srcCode = 110033 or $srcCode = 110034 or $srcCode = 110035 or $srcCode = 110036">
				<nationality>37</nationality>
			</xsl:when>
			<xsl:when test="$srcCode = 110005 or $srcCode = 110006">
				<nationality>37</nationality>
			</xsl:when>
			<xsl:otherwise>
				<nationality>37</nationality>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="sum">
		<xsl:param name="nodes"/>
		<xsl:param name="sum" select="0"/>
		<xsl:variable name="curr" select="$nodes[1]"/>
		<!-- if we have a node, calculate & recurse -->
		<xsl:if test="$curr">
			<xsl:variable name="runningsum" select="$sum + $curr/@value"/>
			<xsl:call-template name="sum">
				<xsl:with-param name="nodes" select="$nodes[position() &gt; 1]"/>
				<xsl:with-param name="sum" select="$runningsum"/>
			</xsl:call-template>
		</xsl:if>
		<!-- if we don't have a node (last recursive step), return sum -->
		<xsl:if test="not($curr) and $sum!=0">
			<premium>
				<xsl:value-of select="$sum"/>
			</premium>
		</xsl:if>
	</xsl:template>
	<!--for EShengLeYou-->
	<xsl:template name="subProduct1">
		<xsl:for-each select="/BusinessTransactionRequest/InsurancePolicy/products/product">
			<product>
				<la-no>
					<xsl:number value="position()"/>
				</la-no>
				<product-num>100</product-num>
				<external-prd-code>
					<xsl:value-of select="productCode"/>
				</external-prd-code>
				<product-name>
					<xsl:value-of select="name"/>
				</product-name>
				<is-waiver>N</is-waiver>
				<waiver-num/>
				<waiver-object/>
				<charge-mode>5</charge-mode>
				<pay-period>0</pay-period>
				<pay-year>0</pay-year>
				<end-period>0</end-period>
				<end-year>0</end-year>
				<pay-ensure>0</pay-ensure>
				<pay-type>0</pay-type>
				<xsl:for-each select="Properties/Property">
					<xsl:choose>
						<xsl:when test="@kind='unitCount' ">
							<unit>
								<xsl:value-of select="@value"/>
							</unit>
						</xsl:when>
						<xsl:when test="@kind='grossPremium' ">
							<discount-prem>
								<xsl:value-of select="@value"/>
							</discount-prem>
						</xsl:when>
						<xsl:when test="@kind='insuredAmount' ">
							<amount>
								<xsl:value-of select="@value"/>
							</amount>
						</xsl:when>
						<!-- add by peter-->
						<xsl:when test="@kind='coveragePeriod' ">
							<coverage-period>
								<xsl:value-of select="@value"/>
							</coverage-period>
						</xsl:when>
						<xsl:when test="@kind='coverageYear' ">
							<coverage-year>
								<xsl:value-of select="@value"/>
							</coverage-year>
						</xsl:when>
						<xsl:when test="@kind='chargeYear' ">
							<charge-year>
								<xsl:value-of select="@value"/>
							</charge-year>
						</xsl:when>
						<xsl:when test="@kind='chargePeriod' ">
							<charge-period>
								<xsl:value-of select="@value"/>
							</charge-period>
						</xsl:when>
						<!-- add For ILP 20130303-->
						<xsl:when test="@kind='singleTopUpAmount' ">
							<single-topup-amount>
								<xsl:value-of select="@value"/>
							</single-topup-amount>
						</xsl:when>
						<xsl:when test="@kind='regularTopUpAmount' ">
							<regular-topup-amount>
								<xsl:value-of select="@value"/>
							</regular-topup-amount>
						</xsl:when>
					</xsl:choose>
				</xsl:for-each>
				<count-way/>
				<bonus-choice/>
				<deduct/>
				<xsl:for-each select="Properties/Property">
					<xsl:choose>
						<xsl:when test="@kind='discountRate' ">
							<pay-rate>
								<xsl:value-of select="@value"/>
							</pay-rate>
						</xsl:when>
					</xsl:choose>
				</xsl:for-each>
				<column1/>
				<column2/>
				<column3/>
				<column4/>
				<column5/>
				<main-riskcode/>
				<password/>
				<rate/>
				<cvali-date/>
				<autopay-flag/>
				<bonuspay-mode/>
				<sub-flag/>
				<Iscash-autopay/>
				<Iscash-joininvest/>
				<health-flag/>
				<fullbonus-getmode/>
				<first-rate/>
				<sure-rate/>
				<end-date/>
				<pay-date/>
				<xsl:for-each select="funds">
					<funds>
						<xsl:for-each select="fund">
							<fund>
								<prem-type>
									<xsl:choose>
										<xsl:when test="premType=3">4</xsl:when>
										<xsl:when test="premType=4">3</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="premType"/>
										</xsl:otherwise>
									</xsl:choose>
								</prem-type>
								<account-code>
									<xsl:value-of select="accountCode"/>
								</account-code>
								<xsl:for-each select="Properties/Property">
									<xsl:choose>
										<xsl:when test="@kind='assignRate'">
											<assign-rate>
												<xsl:value-of select="@value"/>
											</assign-rate>
											<column1/>
											<column2/>
											<column3/>
											<column4/>
										</xsl:when>
									</xsl:choose>
								</xsl:for-each>
							</fund>
						</xsl:for-each>
					</funds>
				</xsl:for-each>
			</product>
		</xsl:for-each>
	</xsl:template>
	<!--for WenYingYiSheng-->
	<xsl:template name="subProduct2">
		<xsl:if test="/BusinessTransactionRequest/InsurancePolicy/productCode != ''">
			<product>
				<la-no>
					<xsl:number value="position()"/>
				</la-no>
				<product-num>100</product-num>
				<external-prd-code>
					<xsl:value-of select="/BusinessTransactionRequest/InsurancePolicy/productCode"/>
				</external-prd-code>
				<product-name>
					<xsl:value-of select="/BusinessTransactionRequest/InsurancePolicy/name"/>
				</product-name>
				<is-waiver>N</is-waiver>
				<waiver-num/>
				<waiver-object/>
				<charge-period>1</charge-period>
				<charge-year>0</charge-year>
				<coverage-period>1</coverage-period>
				<coverage-year>0</coverage-year>
				<charge-mode>5</charge-mode>
				<pay-period>0</pay-period>
				<pay-year>0</pay-year>
				<end-period>0</end-period>
				<end-year>0</end-year>
				<pay-ensure>0</pay-ensure>
				<pay-type>0</pay-type>
				<xsl:for-each select="/BusinessTransactionRequest/InsurancePolicy/Properties/Property">
					<xsl:choose>
						<xsl:when test="@kind='unitCount' ">
							<unit>
								<xsl:value-of select="@value"/>
							</unit>
						</xsl:when>
						<xsl:when test="@kind='grossPremium' ">
							<discount-prem>
								<xsl:value-of select="@value"/>
							</discount-prem>
						</xsl:when>
						<xsl:when test="@kind='insuredAmount' ">
							<amount>
								<xsl:value-of select="@value"/>
							</amount>
						</xsl:when>
					</xsl:choose>
				</xsl:for-each>
				<count-way/>
				<bonus-choice/>
				<deduct/>
				<xsl:for-each select="/BusinessTransactionRequest/InsurancePolicy/Properties/Property">
					<xsl:choose>
						<xsl:when test="@kind='discountRate' ">
							<pay-rate>
								<xsl:value-of select="@value"/>
							</pay-rate>
						</xsl:when>
					</xsl:choose>
				</xsl:for-each>
				<column1/>
				<column2/>
				<column3/>
				<column4/>
				<column5/>
				<main-riskcode/>
				<password/>
				<rate/>
				<cvali-date/>
				<autopay-flag/>
				<bonuspay-mode/>
				<sub-flag/>
				<Iscash-autopay/>
				<Iscash-joininvest/>
				<health-flag/>
				<fullbonus-getmode/>
				<first-rate/>
				<sure-rate/>
				<end-date/>
				<pay-date/>
			</product>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>
